package com.xbh.management.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xbh.management.model.ManUserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @program: management-center
 * @description:
 * @author: 许宝华
 * @create: 2021-09-25 17:05
 */
@Mapper
public interface UserRoleMapper extends BaseMapper<ManUserRole> {
    //给指定用户添加角色
    int insertUserRoleByIds(@Param("list") List<String> roleIdList,
                            @Param("userId") Long userId,
                            @Param("createPerson") String createPerson,
                            @Param("updatePerson") String updatePerson,
                            @Param("createTime") Date createTime,
                            @Param("updateTime") Date updateTime,
                            @Param("deleted") Integer deleted);

    //给指定角色添加用户
    int insertRoleRelationUserByIds(@Param("list") List<String> userIdList,
                            @Param("roleId") Long roleId,
                            @Param("createPerson") String createPerson,
                            @Param("updatePerson") String updatePerson,
                            @Param("createTime") Date createTime,
                            @Param("updateTime") Date updateTime,
                            @Param("deleted") Integer deleted);


    int deleteUserRoleByUserIdAndRoleId(@Param("userId") Long userId,@Param("roleId") Long roleId);
}
